/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ee.aop;

import javax.ejb.Asynchronous;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.inject.Inject;
import org.apache.log4j.Logger;

/**
 *
 * @author Gabriel Bran <gbran.u@gmail.com>
 */
@Stateless
@LocalBean
public class LoggerBean {

    @Inject
    private Logger logger;

    @Asynchronous
    public void info(String message) {
        logger.info("Id hilo que registra el log: "+Thread.currentThread().getName());
        logger.info(message);
    }

    @Asynchronous
    public void info(Throwable e, String message) {
        logger.info(message, e);
    }

    @Asynchronous
    public void warn(String message) {
        logger.warn(message);
    }

    @Asynchronous
    public void warn(Throwable e, String message) {
        logger.warn(message, e);
    }

    @Asynchronous
    public void error(Throwable e, String message) {
        logger.error(message, e);
    }
}
